class RSWebHandler:
    def __init__(self, recipe_server):
        self.rs = recipe_server
                
    def refresh_recipe_blocks(self):
        self.rs.send_recipe_blocks = True
        
    def stop(self):
        from common import web_server        
        web_server.stop()      
    def reset(self):
        self.rs.reset()
    def run_sql(self, query):
        self.rs.run_sql(query)
    def web_publish(self):
        rs = self.rs
        m = {}
        m['rpc_port'] = rs.rpc_port
        m['recipes'] = rs.local_recipes                
        if rs.sql_results is not None:
            m['sql_results'] = rs.sql_results
            rs.sql_results = None   
        return m